<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>医生患者关联管理</h2>
    </div>
    <div class="clearfix">
        <div class="col-xs-9"></div>
        <!-- 高级搜索 -->
        <div class="search-form  col-xs-3 text-right">
            <div class="input-group">
                <input type="text" name="sid" class="search-input form-control" value="{:I('sid')}"
                       placeholder="请输入患者或者医生或者专家的ID">
                <span class="input-group-btn">  <a class="btn btn-default" id="search" url="{:U('')}"><i class="icon-search"></i></a></span>
            </div>
            <!--<div><button onclick="syncServer()">一键同步</button></div>-->
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table with-padding">
        <table class="table table-bordered table-striped ">
            <thead>
            <tr>
                <th class="">患者id</th>
                <th class="">患者姓名</th>
                <!--<th class="">用户帐号</th>-->
                <th class="">手机号</th>
                <th class="">医生id</th>
                <th class="">医生姓名</th>
                <th class="">医生手机号</th>
                <th>所属地区</th>
                <!--<th class="">备注信息</th>-->
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="list">
                <volist name="list" id="vo">
                    <tr>
                        <td>{$vo.user_id}</td>
                        <td><a href="{:U('Admin/User/expandinfo_details',array('uid'=>$vo['uid']))}" >{$vo.user_id|get_nickname}</a></td>
                        <td><a href="{:U('Admin/User/expandinfo_details',array('uid'=>$vo['uid']))}" >{$vo.user_id|get_username}</a></td>
                        <td>{$vo.doctor_id}</td>
                        <td><a href="{:U('Admin/User/expandinfo_details',array('uid'=>$vo['uid']))}" >{$vo.doctor_id|get_nickname}</a></td>
                        <td><a href="{:U('Admin/User/expandinfo_details',array('uid'=>$vo['uid']))}" >{$vo.doctor_id|get_username}</a></td>
                        <td>{$vo.user_id|get_district}</td>
                        <td>
                            <button onclick="cancelBind({$vo.user_id})"> 取消关联</button>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容!</td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="with-padding">
        {$page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        function cancelBind(id){
            if(confirm('确定要删除吗?') ){
                location.href='{:U("cancelBind")}?user_id='+id;
            }
        }
        function syncServer(){
            toast.showLoading();
            toast.hideLoading();
        }
//        $(function(){
//        });
        //导航高亮
        highlight_subnav("{:U('User/index')}");
    </script>
    <style>
        .big_loading{
            z-index: 9999;
            position: fixed;
            margin: 0px auto;
            bottom: 0px;
            left: 50%;
        }
    </style>
</block>